local skill = fk.CreateSkill{
  name = "tea__mengsong",
}
---@type TrigSkelSpec<EventPhaseChangingFunc >
local mengsong = {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skill.name) and ((player.phase == Player.Judge and #player:getCardIds("j") > 0) or player.phase == Player.Draw) then
      --local card = Fk:cloneCard("bogus_flower") --fixme
      local card = Fk:cloneCard("ex_nihilo")
      return player:canUseTo(card, player)
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    --local card = Fk:cloneCard("bogus_flower")
    local card = Fk:cloneCard("ex_nihilo")
    card.skillName = skill.name
    if player.phase == Player.Judge then
      card:addSubcards(player:getCardIds("j"))
    else
      card:addSubcards(room:getNCards(1))
    end
    local use = {
      from = player,
      tos = { player },
      card = card,
    }
    room:useCard(use)
    data.phase_end = true
    return true
  end,
}
skill:addEffect(fk.EventPhaseStart, mengsong)
return skill